package com.sskj.hhrt.login;

import com.sskj.hhrt.BasePresenter;
import com.sskj.hhrt.api.ApiObserver;
import com.sskj.base.utils.MD5Utils;
import com.sskj.base.utils.RxUtils;
import com.sskj.hhrt.api.Api;


/**
 * @author Hey
 * Create at  2019/03/21
 */
class RegisterPresenter extends BasePresenter<RegisterActivity> {

    public void sendCode(String account) {
        Api.getInstance().getCode("1", account)
                .compose(RxUtils.transform())
                .subscribe(new ApiObserver<String>(this, true) {
                    @Override
                    public void onSuccess(String data) {
                        mView.sendCodeSuccess();
                    }
                });

    }

    public void register(String account, String code, String ps, String ps2, String inviteCode) {
        Api.getInstance().register(account, code, ps, ps2, inviteCode)
                .compose(RxUtils.transform())
                .subscribe(new ApiObserver<Object>(this, true) {
                    @Override
                    public void onSuccess(Object data) {
                        mView.registerSuccess();
                    }
                });
    }
}
